home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Taifun / Taifun 007 (1987-02-15)(Ossowski, Stefan)(DE)(PD).zip / Taifun 007 (1987-02-15)(Ossowski, Stefan)(DE)(PD).adf / C Compiler / c.h < prev    next >
C/C++ Source or Header  |  1987-03-04  |  3KB  |  118 lines

  1. /*
  2.  *    68000 C compiler
  3.  *
  4.  *    Copyright 1984, 1985, 1986 Matthew Brandt.
  5.  *  all commercial rights reserved.
  6.  *
  7.  *    This compiler is intended as an instructive tool for personal use. Any
  8.  *    use for profit without the written consent of the author is prohibited.
  9.  *
  10.  *    This compiler may be distributed freely for non-commercial use as long
  11.  *    as this notice stays intact. Please forward any enhancements or questions
  12.  *    to:
  13.  *
  14.  *        Matthew Brandt
  15.  *        Box 920337
  16.  *        Norcross, Ga 30092
  17.  */
  18.  
  19. /*      compiler header file    */
  20.  
  21. enum e_sym {
  22.         id, cconst, iconst, lconst, sconst, rconst, plus, minus,
  23.         star, divide, lshift, rshift, modop, eq, neq, lt, leq, gt,
  24.         geq, assign, asplus, asminus, astimes, asdivide, asmodop,
  25.         aslshift, asrshift, asand, asor, autoinc, autodec, hook, compl,
  26.         comma, colon, semicolon, uparrow, openbr, closebr, begin, end,
  27.         openpa, closepa, pointsto, dot, lor, land, not, or, and, kw_int,
  28.         kw_void, kw_char, kw_float, kw_double, kw_struct, kw_union,
  29.         kw_long, kw_short, kw_unsigned, kw_auto, kw_extern,
  30.         kw_register, kw_typedef, kw_static, kw_goto, kw_return,
  31.         kw_sizeof, kw_break, kw_continue, kw_if, kw_else, kw_for,
  32.         kw_do, kw_while, kw_switch, kw_case, kw_default, kw_enum,
  33.         eof };
  34.  
  35. enum e_sc {
  36.         sc_static, sc_auto, sc_global, sc_external, sc_type, sc_const,
  37.         sc_member, sc_label, sc_ulabel };
  38.  
  39. enum e_bt {
  40.         bt_char, bt_short, bt_long, bt_float, bt_double, bt_pointer,
  41.         bt_unsigned, bt_struct, bt_union, bt_enum, bt_func, bt_ifunc};
  42.  
  43. struct slit {
  44.         struct slit     *next;
  45.         int             label;
  46.         char            *str;
  47.         };
  48.  
  49. struct sym {
  50.         struct sym *next;
  51.         char  *name;
  52.         enum e_sc storage_class;
  53.         union   {
  54.                 long            i;
  55.                 unsigned        u;
  56.                 double          f;
  57.                 char            *s;
  58.                 }
  59.                         value;
  60.  
  61.         struct typ {
  62.                 enum e_bt type;
  63.                 char val_flag;       /* is it a value type */
  64.                 long size;
  65.                 struct stab {
  66.                         struct sym      *head, *tail;
  67.                         }       lst;
  68.                 struct typ      *btp;
  69.                 char            *sname;
  70.                 } *tp;
  71.         };
  72.  
  73. #define SYM     struct sym
  74. #define TYP     struct typ
  75. #define TABLE   struct stab
  76.  
  77. #define MAX_STRLEN      120
  78. #define MAX_STLP1       121
  79. #define ERR_SYNTAX      0
  80. #define ERR_ILLCHAR     1
  81. #define ERR_FPCON       2
  82. #define ERR_ILLTYPE     3
  83. #define ERR_UNDEFINED   4
  84. #define ERR_DUPSYM      5
  85. #define ERR_PUNCT       6
  86. #define ERR_IDEXPECT    7
  87. #define ERR_NOINIT      8
  88. #define ERR_INCOMPLETE  9
  89. #define ERR_ILLINIT     10
  90. #define ERR_INITSIZE    11
  91. #define ERR_ILLCLASS    12
  92. #define ERR_BLOCK       13
  93. #define ERR_NOPOINTER   14
  94. #define ERR_NOFUNC      15
  95. #define ERR_NOMEMBER    16
  96. #define ERR_LVALUE      17
  97. #define ERR_DEREF       18
  98. #define ERR_MISMATCH    19
  99. #define ERR_EXPREXPECT  20
  100. #define ERR_WHILEXPECT  21
  101. #define ERR_NOCASE      22
  102. #define ERR_DUPCASE     23
  103. #define ERR_LABEL       24
  104. #define ERR_PREPROC     25
  105. #define ERR_INCLFILE    26
  106. #define ERR_CANTOPEN    27
  107. #define ERR_DEFINE      28
  108.  
  109. /*      alignment sizes         */
  110.  
  111. #define AL_CHAR         1
  112. #define AL_SHORT        2
  113. #define AL_LONG         2
  114. #define AL_POINTER      2
  115. #define AL_FLOAT        2
  116. #define AL_DOUBLE       2
  117. #define AL_STRUCT       2
  118.